# Maintainer: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
pkgname=mangohud
pkgver=0.7.0
pkgrel=0
pkgdesc="Vulkan and OpenGL overlay for monitoring FPS, temperatures, CPU/GPU load and more"
url="https://github.com/flightlessmango/MangoHud"
# Fails to build on 32 bit arches
arch="all !armhf !armv7 !x86"
license="MIT"
subpackages="$pkgname-doc"
makedepends="
	dbus-dev
	glew-dev
	glfw-dev
	glslang-dev
	libx11-dev
	libxrandr-dev
	mesa-dev
	meson
	ninja
	nlohmann-json
	py3-mako
	sdl2-dev
	spdlog-dev
	vulkan-headers
	vulkan-loader-dev
	wayland-dev
	"
source="
	$pkgname-$pkgver.tar.xz::https://github.com/flightlessmango/MangoHud/releases/download/v$pkgver/MangoHud-v$pkgver-Source.tar.xz

	0001-fix-ld_libdir_mangohud.patch
	0002-fix-stat64.patch
	fc925300601098dc45241087626369843d6a2c66.patch
	"
builddir="$srcdir/MangoHud-v$pkgver"
options="!check" # tests not working with --wrap-mode=nodownload

build() {
	abuild-meson \
		-Dappend_libdir_mangohud=false \
		-Dimgui:glfw=enabled \
		-Dimgui:opengl=enabled \
		-Dimgui:sdl2=enabled \
		-Dimgui:vulkan=enabled \
		-Dmangoapp=true \
		-Dmangoapp_layer=true \
		-Dmangohudctl=true \
		-Dtests=disabled \
		-Dwith_dbus=enabled \
		-Dwith_wayland=enabled \
		-Dwith_xnvctrl=disabled \
		. output
	meson compile -C output
}

check() {
	meson test --no-rebuild -v -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

sha512sums="
d875052ab6017923b12acfc76d6955b8a59c90ea5afa91809579ed59d123945c3c35e4613e7581e502edcb77c8037c5f0ac00e77e2527f9b394c92bb7823a9e4  mangohud-0.7.0.tar.xz
eced3fd10cc50231363eaf02340bb48f7c27faead82af11cdc0e5536c50db03b32de5268311192cd6f68ccc4dc7921451240a019e155e28fe517e63e7dd1737b  0001-fix-ld_libdir_mangohud.patch
38653a58076ff809bf3d37407903206f84a9dff61d99ffda9fce2a889e9977f3063fb3c35b7db3d7bc5d3e226808f83a31748ea0b517c5cc56d613ebd2b2d210  0002-fix-stat64.patch
3209fb641de48566572253d1706152f6e2b3e468284d8ef32471698eaff8c763eea83741957162d726e76aba6c85f24042d8f77d31db33b066831f4443aba015  fc925300601098dc45241087626369843d6a2c66.patch
"
